package com.xianxing.article.service.impl;

import com.xianxing.article.dao.ArticleMapper;
import com.xianxing.article.service.ArticleService;
import com.xianxing.common.pojo.Article;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArticleServiceImpl implements ArticleService {


    @Autowired
    private ArticleMapper articleMapper;

    /**
     * 查询所有文章数据
     * @return
     */
    @Override
    public List<Article> findAll() {
        List<Article> articleList = articleMapper.selectAll();
        return articleList;
    }

    /**
     * 根据id查询文章
     * @param id
     * @return
     */
    @Override
    public Article findById(String id) {
        Article article = articleMapper.selectByPrimaryKey(id);
        return article;
    }

}
